/*****************************************************************************
Copyright (c) 2011 Nokia Siemens Networks. All rights reserved.

This software is proprietary to and embodies the confidential technology 
of Nokia Siemens Networks. Possession, use, or copying of this software 
and media is authorized only pursuant to a valid written license from 
Nokia Siemens Networks.
*****************************************************************************/
package com.fashion.web.actions.management.gallery;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.fashion.model.gallery.GalleryColumn;

/**
 * Description TODO
 *
 * <br><b>Change Note:</b>
 * <ul>
 * <li>Date:</li>
 * <li>Modifier:</li>
 * <li>Description:</li>
 * </ul>
 *
 * @author TODO created at Jun 12, 2011
 */
public class ColumnComboTreeModel implements Serializable{
    private String id;
    private String text;
    private List<ColumnComboTreeModel> children =new ArrayList<ColumnComboTreeModel>();
    
    static List<ColumnComboTreeModel> getInstances(List<GalleryColumn> columns){
        List<ColumnComboTreeModel> list = new ArrayList<ColumnComboTreeModel>(); 
        for(GalleryColumn c: columns){
            list.add(getInstance(c));
        }           
        return list;
    }
    
    static ColumnComboTreeModel getInstance(GalleryColumn column){
        ColumnComboTreeModel columnComboTree = new ColumnComboTreeModel();
        columnComboTree.id = column.getId();
        columnComboTree.text = column.getName();
        if (column.getChildren() != null){
            for(GalleryColumn c:column.getChildren()){
                columnComboTree.children.add(getInstance(c));
            }
        }
        return columnComboTree;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public List<ColumnComboTreeModel> getChildren() {
        return children;
    }

    public void setChildren(List<ColumnComboTreeModel> children) {
        this.children = children;
    }
    
}

